Use [abyx_svcm]
GO

--[SP_SVC_ServiceOrdersGet]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_ServiceOrdersGet]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_ServiceOrdersGet]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_ServiceOrdersGet]    Script Date: 2012-10-28 15:28 ******/
CREATE PROCEDURE [dbo].[SP_SVC_ServiceOrdersGet]
	 @ServiceOrderId uniqueidentifier
AS
BEGIN
	SELECT * FROM [SVC_ServiceOrders] WHERE [ServiceOrderId]=@ServiceOrderId
	RETURN @@error
END
GO

--[SP_SVC_ServiceOrdersInsert]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_ServiceOrdersInsert]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_ServiceOrdersInsert]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_ServiceOrdersInsert]    Script Date: 2012-10-28 15:28 ******/
CREATE PROCEDURE [SP_SVC_ServiceOrdersInsert]
	 @ServiceOrderId uniqueidentifier	,@CustomerId uniqueidentifier	,@OrderNumber varchar(50)	,@OrderReceivedDate datetime	,@OrderCompletedDate datetime	,@ServiceEquipmentId uniqueidentifier	,@ServiceItemImieSerialNumber varchar(50)	,@EstimatedDate datetime	,@EstimatedPrice decimal(18,5)	,@RegistrationFee decimal(18,5)	,@ActualPrice decimal(18,5)	,@EstimateApproved char(1)	,@Status varchar(255)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	INSERT INTO [SVC_ServiceOrders]
		 VALUES( @ServiceOrderId,@CustomerId,@OrderNumber,@OrderReceivedDate,@OrderCompletedDate,@ServiceEquipmentId,@ServiceItemImieSerialNumber,@EstimatedDate,@EstimatedPrice,@RegistrationFee,@ActualPrice,@EstimateApproved,@Status,@LMUserId,@LMDate)
	RETURN @@error
END
GO

--[SP_SVC_ServiceOrdersUpdate]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_ServiceOrdersUpdate]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_ServiceOrdersUpdate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_ServiceOrdersUpdate]    Script Date: 2012-10-28 15:28 ******/
CREATE PROCEDURE [dbo].[SP_SVC_ServiceOrdersUpdate]
	 @ServiceOrderId uniqueidentifier	,@CustomerId uniqueidentifier	,@OrderNumber varchar(50)	,@OrderReceivedDate datetime	,@OrderCompletedDate datetime	,@ServiceEquipmentId uniqueidentifier	,@ServiceItemImieSerialNumber varchar(50)	,@EstimatedDate datetime	,@EstimatedPrice decimal(18,5)	,@RegistrationFee decimal(18,5)	,@ActualPrice decimal(18,5)	,@EstimateApproved char(1)	,@Status varchar(255)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	UPDATE [SVC_ServiceOrders]
	   SET
			 [CustomerId] = @CustomerId			,[OrderNumber] = @OrderNumber			,[OrderReceivedDate] = @OrderReceivedDate			,[OrderCompletedDate] = @OrderCompletedDate			,[ServiceEquipmentId] = @ServiceEquipmentId			,[ServiceItemImieSerialNumber] = @ServiceItemImieSerialNumber			,[EstimatedDate] = @EstimatedDate			,[EstimatedPrice] = @EstimatedPrice			,[RegistrationFee] = @RegistrationFee			,[ActualPrice] = @ActualPrice			,[EstimateApproved] = @EstimateApproved			,[Status] = @Status			,[LMUserId] = @LMUserId			,[LMDate] = @LMDate	WHERE [ServiceOrderId] = @ServiceOrderId
	RETURN @@error
END
GO

--[SP_SVC_ServiceOrdersDelete]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_ServiceOrdersDelete]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_ServiceOrdersDelete]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_ServiceOrdersDelete]    Script Date: 2012-10-28 15:28 ******/
CREATE PROCEDURE [dbo].[SP_SVC_ServiceOrdersDelete]
	@ServiceOrderId uniqueidentifier
AS
BEGIN
	DELETE FROM [SVC_ServiceOrders] WHERE [ServiceOrderId]=@ServiceOrderId
	RETURN @@error
END
Go

Use [abyx_svcm]
GO

--[SP_SVC_SOEquipmentAccessoriesGet]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentAccessoriesGet]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentAccessoriesGet]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentAccessoriesGet]    Script Date: 2012-10-28 15:29 ******/
CREATE PROCEDURE [dbo].[SP_SVC_SOEquipmentAccessoriesGet]
	 @ServiceOrderEquipmentAccessoryId uniqueidentifier
AS
BEGIN
	SELECT * FROM [SVC_SOEquipmentAccessories] WHERE [ServiceOrderEquipmentAccessoryId]=@ServiceOrderEquipmentAccessoryId
	RETURN @@error
END
GO

--[SP_SVC_SOEquipmentAccessoriesInsert]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentAccessoriesInsert]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentAccessoriesInsert]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentAccessoriesInsert]    Script Date: 2012-10-28 15:29 ******/
CREATE PROCEDURE [SP_SVC_SOEquipmentAccessoriesInsert]
	 @ServiceOrderEquipmentAccessoryId uniqueidentifier	,@ServiceOrderId uniqueidentifier	,@Name varchar(255)	,@Description varchar(255)	,@Returned char(1)	,@Remarks varchar(255)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	INSERT INTO [SVC_SOEquipmentAccessories]
		 VALUES( @ServiceOrderEquipmentAccessoryId,@ServiceOrderId,@Name,@Description,@Returned,@Remarks,@LMUserId,@LMDate)
	RETURN @@error
END
GO

--[SP_SVC_SOEquipmentAccessoriesUpdate]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentAccessoriesUpdate]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentAccessoriesUpdate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentAccessoriesUpdate]    Script Date: 2012-10-28 15:29 ******/
CREATE PROCEDURE [dbo].[SP_SVC_SOEquipmentAccessoriesUpdate]
	 @ServiceOrderEquipmentAccessoryId uniqueidentifier	,@ServiceOrderId uniqueidentifier	,@Name varchar(255)	,@Description varchar(255)	,@Returned char(1)	,@Remarks varchar(255)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	UPDATE [SVC_SOEquipmentAccessories]
	   SET
			 [ServiceOrderId] = @ServiceOrderId			,[Name] = @Name			,[Description] = @Description			,[Returned] = @Returned			,[Remarks] = @Remarks			,[LMUserId] = @LMUserId			,[LMDate] = @LMDate	WHERE [ServiceOrderEquipmentAccessoryId] = @ServiceOrderEquipmentAccessoryId
	RETURN @@error
END
GO

--[SP_SVC_SOEquipmentAccessoriesDelete]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentAccessoriesDelete]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentAccessoriesDelete]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentAccessoriesDelete]    Script Date: 2012-10-28 15:29 ******/
CREATE PROCEDURE [dbo].[SP_SVC_SOEquipmentAccessoriesDelete]
	@ServiceOrderEquipmentAccessoryId uniqueidentifier
AS
BEGIN
	DELETE FROM [SVC_SOEquipmentAccessories] WHERE [ServiceOrderEquipmentAccessoryId]=@ServiceOrderEquipmentAccessoryId
	RETURN @@error
END
Go

Use [abyx_svcm]
GO

--[SP_SVC_SOEquipmentServiceTasksGet]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentServiceTasksGet]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentServiceTasksGet]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentServiceTasksGet]    Script Date: 2012-10-28 15:30 ******/
CREATE PROCEDURE [dbo].[SP_SVC_SOEquipmentServiceTasksGet]
	 @ServiceOrderEquipmentServiceTaskId uniqueidentifier
AS
BEGIN
	SELECT * FROM [SVC_SOEquipmentServiceTasks] WHERE [ServiceOrderEquipmentServiceTaskId]=@ServiceOrderEquipmentServiceTaskId
	RETURN @@error
END
GO

--[SP_SVC_SOEquipmentServiceTasksInsert]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentServiceTasksInsert]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentServiceTasksInsert]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentServiceTasksInsert]    Script Date: 2012-10-28 15:30 ******/
CREATE PROCEDURE [SP_SVC_SOEquipmentServiceTasksInsert]
	 @ServiceOrderEquipmentServiceTaskId uniqueidentifier	,@ServiceOrderId uniqueidentifier	,@ServiceTaskId uniqueidentifier	,@Status varchar(50)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	INSERT INTO [SVC_SOEquipmentServiceTasks]
		 VALUES( @ServiceOrderEquipmentServiceTaskId,@ServiceOrderId,@ServiceTaskId,@Status,@LMUserId,@LMDate)
	RETURN @@error
END
GO

--[SP_SVC_SOEquipmentServiceTasksUpdate]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentServiceTasksUpdate]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentServiceTasksUpdate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentServiceTasksUpdate]    Script Date: 2012-10-28 15:30 ******/
CREATE PROCEDURE [dbo].[SP_SVC_SOEquipmentServiceTasksUpdate]
	 @ServiceOrderEquipmentServiceTaskId uniqueidentifier	,@ServiceOrderId uniqueidentifier	,@ServiceTaskId uniqueidentifier	,@Status varchar(50)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	UPDATE [SVC_SOEquipmentServiceTasks]
	   SET
			 [ServiceOrderId] = @ServiceOrderId			,[ServiceTaskId] = @ServiceTaskId			,[Status] = @Status			,[LMUserId] = @LMUserId			,[LMDate] = @LMDate	WHERE [ServiceOrderEquipmentServiceTaskId] = @ServiceOrderEquipmentServiceTaskId
	RETURN @@error
END
GO

--[SP_SVC_SOEquipmentServiceTasksDelete]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_SOEquipmentServiceTasksDelete]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_SOEquipmentServiceTasksDelete]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_SOEquipmentServiceTasksDelete]    Script Date: 2012-10-28 15:30 ******/
CREATE PROCEDURE [dbo].[SP_SVC_SOEquipmentServiceTasksDelete]
	@ServiceOrderEquipmentServiceTaskId uniqueidentifier
AS
BEGIN
	DELETE FROM [SVC_SOEquipmentServiceTasks] WHERE [ServiceOrderEquipmentServiceTaskId]=@ServiceOrderEquipmentServiceTaskId
	RETURN @@error
END
Go

